import Vue from 'vue'
import App from './App'

/* 路由 */
import router from './router'

/* axios */
// import axios from './api'
// import api from './api/login'
// Vue.prototype.http = axios;
// Vue.prototype.api = api;

/** elementUI */
// import ElementUI from 'element-ui'
// import 'element-ui/lib/theme-chalk/index.css';
// import './styles/element-variables.scss'
// Vue.use(ElementUI);

/** 按需引入 elementUI */
import { Button, Select, Option, Form, FormItem, Input, Dialog, Message, Image, Backtop, Icon, Popover } from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css';
import './styles/element-variables.scss'
Vue.use(Button)
Vue.use(Select)
Vue.use(Option)
Vue.use(Form)
Vue.use(FormItem)
Vue.use(Input)
Vue.use(Dialog)
Vue.use(Image)
Vue.use(Backtop)
Vue.use(Icon)
Vue.use(Popover)
Vue.prototype.$message = Message

import '@/styles/index.scss'

/* swiper */
import 'swiper/dist/css/swiper.min.css';

/* 重置样式 */
import './assets/css/reset.min.css'

/* jquery */
import 'jquery'

/* bootstarp */
import './assets/css/bootstrap.min.css'
import './assets/js/bootstrap.min'

/* animate.css */
import 'animate.css'

import VueLazyload from 'vue-lazyload'
Vue.use(VueLazyload, {
  //参数配置 可不填
  // 懒加载默认加载图片
  // loading: 'xxx.png',
  // 加载失败后加载的图片
  // error: 'xxx.png',
  preLoad: 1.3, // 预加载高度的比例
  attempt: 3 // 尝试加载次数
})

/* 头部组件 */
import Header from './components/Header'
Vue.component(Header.name,Header)

/* 尾部组件 */
import Footer from './components/Footer'
Vue.component(Footer.name,Footer)

/* 回到顶部 */
import GoTop from './components/GoTop'
Vue.component(GoTop.name,GoTop)

Vue.config.productionTip = false

router.beforeEach((to, from, next) => {
  // if(to.meta.title){
  //   document.title = to.meta.title
  // }
  next();
});

new Vue({
  el: '#app',
  router,
  render: h => h(App)
})
